package com.mfw.springboot.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mfw.springboot.common.DataGroupByDateDTO;
import com.mfw.springboot.model.dto.trainingPlan.TrainingPlanQueryRequest;
import com.mfw.springboot.model.entity.TrainingPlan;
import com.mfw.springboot.model.vo.TrainingPlanVO;

import javax.servlet.http.HttpServletRequest;

import java.util.Date;
import java.util.List;

/**
 * 训练计划服务
 *
 * @author mfw
 * @from <a href="https://gitee.com/hanhuaifei/projects">我的gitee</a>
 * @Date 2024/9/26
 */
public interface TrainingPlanService extends IService<TrainingPlan> {

    /**
     * 校验数据
     *
     * @param trainingPlan
     * @param add 对创建的数据进行校验
     */
    void validTrainingPlan(TrainingPlan trainingPlan, boolean add);

    /**
     * 获取查询条件
     *
     * @param trainingPlanQueryRequest
     * @return
     */
    QueryWrapper<TrainingPlan> getQueryWrapper(TrainingPlanQueryRequest trainingPlanQueryRequest);
    
    /**
     * 获取训练计划封装
     *
     * @param trainingPlan
     * @param request
     * @return
     */
    TrainingPlanVO getTrainingPlanVO(TrainingPlan trainingPlan, HttpServletRequest request);

    /**
     * 分页获取训练计划封装
     *
     * @param trainingPlanPage
     * @param request
     * @return
     */
    Page<TrainingPlanVO> getTrainingPlanVOPage(Page<TrainingPlan> trainingPlanPage, HttpServletRequest request);

    /**
    * 分按日期分组查询训练计划新增数量
    *
    * @param beginDate 开始时间
    * @param endDate   结束时间
    * @return
    */
    List<DataGroupByDateDTO> countByDay(Date beginDate, Date endDate);
}
